<?php
/**
 * This is the index.ctp
 * @access public
 * @version 1.0
 */
$loggedUser =  $authUser;
$loggedUser_id = $loggedUser['id'];
$modified_date = date('Y-m-d H:i:s');
$created_date = date('Y-m-d H:i:s');
?>
<!-- Main content -->
<section role="main" id="main">
    <!-- Header -->
    <?php
        echo $this->element('page_header');
        echo $this->element('navigations/admin_navbar');
    ?>

    <div class="with-padding">
        <div class="columns">
            <div class="new-row-mobile twelve-columns six-columns-tablet twelve-columns-mobile">

                <h3 class="thin underline">Setup System</h3>

                <?php echo $this->Form->create('Configuration', array('default' => false, 'id' => 'system-configuration-form', 'url' => array('controller' => 'Administration', 'action' => 'add'),'inputDefaults' => array('label' => false,'div' => false)));?>

                <fieldset class="fieldset">
                    <legend class="legend">Info</legend>

                    <?php
                    if(!empty($allConfiguration)){
                        foreach($allConfiguration as $config_key => $config_value_array){
                            $config_value = $config_value_array['value'];
                            $config_description = $config_value_array['description'];

                            echo "<p class='button-height' style='border-bottom: 1px solid #ccc;'>";
                            echo "<label class='label' style='width:auto; display:block;'> $config_description </label>";
                            echo $this->Form->input("Configuration.$config_key.value", array('type'=>'text', 'label' => false, 'class' => 'input validate[required] full-width','value'=>"$config_value"));
                            echo $this->Form->input("Configuration.$config_key.id", array('label' => false, 'value'=>"$config_key"));
                            echo $this->Form->input("Configuration.$config_key.modified_by", array('type'=>'hidden','label' => false, 'value'=>"$loggedUser_id"));
                            echo $this->Form->input("Configuration.$config_key.modification_date", array('type'=>'hidden','label' => false, 'value'=>"$modified_date"));
                            echo "</p>";
                        }
                    }
                    ?>


                    <!--<p class="button-height inline-label">
                        <label class="label">Group Name</label>
                        <?php /*echo $this->Form->input('name', array('id'=>'name', 'class' => 'input validate[required] ', 'value'=>'', 'div' => false, 'label' => false,)); */?>
                    </p>
                    <p class="button-height inline-label">
                        <label class="label">Active</label>
                        <?php /*echo $this->Form->input('active', array('id'=>'active', 'class' => 'select expandable-list validate[required] ','style'=>'width:105px;', 'options'=>array('y'=>'Active', 'n'=>'Inactive'), 'div' => false, 'label' => false,)); */?>
                    </p>-->

                    <p class="button-height inline-label">
                        <label for="save-btn" class="label">&nbsp;</label>
                        <button type="submit" class="button" id="save-btn">
                            <span class="button-icon green-gradient"><span class="icon-download"></span></span>
                            Save
                        </button>

                        <button type="button" class="button" id="cancel-btn">
                            <span class="button-icon anthracite-gradient"><span class="icon-cross-round"></span></span>
                            Cancel
                        </button>
                    </p>
                </fieldset>

                <!--<div id="details-form-window" style='padding:10px;'>
                        <?php
/*                        if(!empty($allConfiguration)){
                            // echo debug($allConfiguration);

                            foreach($allConfiguration as $config_key => $config_value_array){
                                $config_value = $config_value_array['value'];
                                $config_description = $config_value_array['description'];



                                echo "<div style='margin-bottom:20px; border-bottom:1px solid #ddd; ' >";
                                echo "<div style='margin-bottom:5px;'> $config_description </div>";
                                echo "<div>".$this->Form->input("Configuration.$config_key.value", array('type'=>'text', 'label' => false, 'class' => 'input validate[required] ','value'=>"$config_value"))."</div>";
                                echo "<div>";
                                echo $this->Form->input("Configuration.$config_key.id", array('label' => false, 'value'=>"$config_key"));
                                echo $this->Form->input("Configuration.$config_key.modified_by", array('type'=>'hidden','label' => false, 'value'=>"$loggedUser_id"));
                                echo $this->Form->input("Configuration.$config_key.modification_date", array('type'=>'hidden','label' => false, 'value'=>"$modified_date"));
                                echo "</div>";
                                echo "</div>";
                            }
                        }
                        */?>
                    </div>-->
                <?php echo $this->Form->end();?>
            </div>
        </div>
    </div>

</section>
<!-- End main content -->

<!-- Side tabs shortcuts -->
<?php echo $this->element('side_tabs_shortcuts'); ?>
<!-- Sidebar/drop-down menu -->
<?php echo $this->element('right_side_infos'); ?>

<?php
echo $this->Html->script('setup.js');
/** Template functions **/
echo $this->Html->script('developr.input.js');
echo $this->Html->script('developr.message.js');
echo $this->Html->script('developr.modal.js');
echo $this->Html->script('developr.navigable.js');
echo $this->Html->script('developr.notify.js');
echo $this->Html->script('developr.scroll.js');
echo $this->Html->script('developr.progress-slider.js');
echo $this->Html->script('developr.tooltip.js');
echo $this->Html->script('developr.confirm.js');
echo $this->Html->script('developr.agenda.js');
echo $this->Html->script('developr.tabs.js');

echo $this->Html->script('libs/tinycon.min.js');
echo $this->Html->script('custom-scripts/admin/settings.js');

// Charts library
// Load the AJAX API
//echo $this->Html->script('google/jsapi.js');
//echo $this->Html->script('custom-scripts/charts.js');
?>